<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/public/default.xhtml"
>

	<f:metadata>
		<f:viewParam name="serviceSupplierId" value="#{serviceSupplierHome.id}"></f:viewParam>
		<f:event listener="#{ratedTradeList.setUsername(serviceSupplierHome.instance.username)}" type="preRenderView"></f:event>
	</f:metadata>
	<ui:define name="head">
		<link href="#{request.getContextPath()}/starRating/css/bootstrap.css" rel="stylesheet" />
		<link href="#{request.getContextPath()}/starRating/css/font-awesome.min.css" rel="stylesheet" />
		<h:outputStylesheet name="css/stylesheet.css" />
		<h:outputStylesheet name="css/public/layout.css" />
		<h:outputStylesheet name="css/public/hover-mask.css" />
		<h:outputStylesheet name="css/public/pull-down.css" />
		<h:outputStylesheet name="css/public/first-pagemain.css" />	
		<h:outputStylesheet name="css/public/zhongjieminglu.css" />
		<link href="#{request.getContextPath()}/starRating/css/star-rating.css" rel="stylesheet" />
		<script type="text/javascript" src="#{request.getContextPath()}/starRating/js/star-rating.js"></script>
		<style type="text/css">
			.ui-button {
				background-color: #3b799d;
				color: #fff;
				background-image: none;
			}
			
			.zjname-list {
				padding-left: 50px;
			}
			
			.zjname-list table tr td {
				padding: 10px 0;
			}
			
			.zjname-list table tr td label {
				margin-right: 10px;
			}
			
			.actionButtons {
				text-align: center;
				display: block;
			}
			
			.label1 {
				width: 20%;			
				background-color: #f5f8fb;					
			}
			
			.certPanel .label {
				width: 15%;			
			}
			
			.value {
				width: 30%;
			}
			
			.ui-panelgrid {
				width: 100%;
			}
			
			.column1 {
				width: 20%
			}
			
			.column2 {
				width: 80%				
			}
			
			*{
				font-family: GothamLight, "sans-serif";
			}
		</style>
	</ui:define>

	<ui:define name="content">
		<p:panel toggleable="true" header="基本信息" style="margin-top: 10px">
			<p:panelGrid cellpadding="5" width="100%">
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="公司名称" />	
					</p:column>
					<p:column styleClass="value">
						<h:outputText value="#{serviceSupplierHome.instance.cnname}" />		
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="单位性质或组织形式" />		
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="companyType" 
							  value="#{serviceSupplierHome.instance.companyType}"/>
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="统一社会信用代码" />
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="creditCode" 
						   value="#{serviceSupplierHome.instance.creditCode}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="注册资金(万元)" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="registeredFund" 
						  value="#{serviceSupplierHome.instance.registeredFund}" />
					</p:column>
				</p:row>	
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="注册登记机关" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="registrationAuthority" 
						  value="#{serviceSupplierHome.instance.registrationAuthority}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="注册登记号" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="registrationNo" 
						  value="#{serviceSupplierHome.instance.registrationNo}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="成立时间" />		
					</p:column>
					<p:column styleClass="value">
						<h:outputText  id="regtime" 
							value="#{serviceSupplierHome.instance.regtime}">
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="法定代表人" />		
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="legalPerson" 
						  		value="#{serviceSupplierHome.instance.legalPerson}" />
					</p:column>
				</p:row>								
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="办公地址" />				
					</p:column>
					<p:column colspan="3">
						<h:outputText id="address" 
					 			 value="#{serviceSupplierHome.instance.address}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="第一联系人" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="firstContactor" 
						  value="#{serviceSupplierHome.instance.firstContactor}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="第一联系人电话" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="firstContactorPhoneNumber" 
						  value="#{serviceSupplierHome.instance.firstContactorPhoneNumber}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="第二联系人" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="secondContactor" 
						  value="#{serviceSupplierHome.instance.secondContactor}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="第二联系人电话" />		
					</p:column>	
					<p:column styleClass="value">
						<h:outputText id="secondContactorPhoneNumber" 
						  value="#{serviceSupplierHome.instance.secondContactorPhoneNumber}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="员工数" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="employeeCount" 
						  value="#{serviceSupplierHome.instance.employeeCount}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="高级职称人数" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="highTitleEmployeeCount" 
							  value="#{serviceSupplierHome.instance.highTitleEmployeeCount}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="中级职称人数" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="mediumTitleEmployeeCount" 
							  value="#{serviceSupplierHome.instance.mediumTitleEmployeeCount}" />
					</p:column>
					<p:column styleClass="label1">
						<p:outputLabel value="初级职称人数" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="beginnerTitleEmployeeCount" 
						  	value="#{serviceSupplierHome.instance.beginnerTitleEmployeeCount}" />
					</p:column>
				</p:row>
				
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="是否政府服务供应商" />				
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="govServiceSupplier" 
						  	 value="#{serviceSupplierHome.instance.govServiceSupplier ? '是' : '否'}" />
					</p:column>

				</p:row>
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="中介机构所在地区" />		
					</p:column>
					<p:column styleClass="value">
						<h:outputText id="region"
			   						value="#{codeDicUtils.getCodeDicValueKeyMap('所在地区')[serviceSupplierHome.instance.region]}" />
					</p:column>	
					<p:column styleClass="label1">
						<p:outputLabel value="营业期限" />					
					</p:column>
					<p:column >
						<h:outputText id="businessAllotedTime"
								   value="#{serviceSupplierHome.instance.busnissAllotedTime}" 
								rendered="#{not serviceSupplierHome.instance.alwaysValid}">
							<f:convertDateTime pattern="yyyy-MM-dd"/>
						</h:outputText>
						<h:outputText value="长期有效"
						   			rendered="#{serviceSupplierHome.instance.alwaysValid}" />
					</p:column>
				</p:row>
					
				<p:row>
					<p:column styleClass="label1">
						<p:outputLabel value="营业执照" />
					</p:column>
					<p:column colspan="3">
						<div id="imgsPreview" >
							<img  data-original="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}" src="#{attachmentUtils.getFullPath(serviceSupplierHome.instance.businessLicenseImages[0])}"  id="img" width="240"/>						
						</div>
						
					</p:column>
				</p:row>
				
				<p:row rendered="#{serviceSupplierHome.instance.taxProveImages.size() > 0}">
					<p:column styleClass="label1">
						<p:outputLabel value="纳税证明" />
					</p:column>
					<p:column styleClass="label1">
							<c:forEach items="#{serviceSupplierHome.instance.taxProveImages}" var="_photo" varStatus="_status">
								<div id="imgsPreview2" >
									<img  data-original="#{attachmentUtils.getFullPath(_photo)}" src="#{attachmentUtils.getFullPath(_photo)}"  id="img" width="240"/>						
								</div>
							</c:forEach>
					</p:column>
				</p:row>	
					
			</p:panelGrid>
		</p:panel>
		
		<p:panel toggleable="true" header="机构简介">
			<h:outputText value="#{serviceSupplierHome.instance.intro}" />
		</p:panel>
		
		<p:panel toggleable="true" header="主营业务">
			<p:repeat var="_business" value="#{serviceSupplierHome.instance.mainBusinesses}">
				<div class="certs">
					<h2>#{_business.agentService.name}</h2>
					<p:panelGrid columns="2" columnClasses="label1, phClass">
						<p:outputLabel value="服务时限承诺"></p:outputLabel>
						<h:outputText value="#{_business.commitOfTime}" />
						
						<p:outputLabel value="服务收费承诺"></p:outputLabel>
						<h:outputText value="#{_business.commitOfPrice}" />
						
						<p:outputLabel value="服务质量承诺"></p:outputLabel>
						<h:outputText value="#{_business.commitOfQuality}" />
					</p:panelGrid>
				</div>
			</p:repeat>
		</p:panel>
		
		<p:panel toggleable="true" header="资质" styleClass="certPanel" >
			<p:repeat var="_cert" value="#{serviceSupplierHome.instance.getValidCerts()}">
				<h2>#{_cert.qualificationClass.name}</h2>
				<p:panelGrid >
					<p:repeat var="_qt" value="#{_cert.qualificationTemplates}">
						<p:row>
							<p:column styleClass="label1">
								<p:outputLabel value="等级: "></p:outputLabel>
							</p:column>
							<p:column>
								<h:outputText value="#{_qt.qualificationLevel.name}" />
							</p:column>
							
							<p:column styleClass="label1">
								<p:outputLabel value="行业范围："></p:outputLabel>
							</p:column>
							<p:column colspan="3">
								<p:repeat var="_sector" value="#{_qt.sectors}">
									<h:outputText value="#{_sector.fullSectorName}" /><br/>
								</p:repeat>
							</p:column>
						</p:row>
					</p:repeat>
					
					<p:row>
						<p:column styleClass="label1">
							<p:outputLabel value="资质审核机关： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.approveDepartmentName}" />
						</p:column>
						
						<p:column styleClass="label1">
							<p:outputLabel value="批准文号/资质证书号： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.approveLicenseNo}" />
						</p:column>
						
						<p:column styleClass="label1">
							<p:outputLabel value="批准时间： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.approveDate}">
								<f:convertDateTime pattern="yyyy-MM-dd"/>
							</h:outputText>
						</p:column>
					</p:row>
					
					<p:row>
						<p:column styleClass="label1">
							<p:outputLabel value="联系人： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.contactor}" />
						</p:column>
						
						<p:column styleClass="label1">
							<p:outputLabel value="联系人电话： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.contactorPhoneNumber}" />
						</p:column>
						
						<p:column styleClass="label1">
							<p:outputLabel value="有效日期： "></p:outputLabel>
						</p:column>
						<p:column>
							<h:outputText value="#{_cert.allotedDate}">
								<f:convertDateTime pattern="yyyy-MM-dd"/>
							</h:outputText>
						</p:column>
					</p:row>
					
					<p:row rendered="#{not _cert.hidden}  ">
						<p:column>
							<p:outputLabel value="资质证书： "></p:outputLabel>							
						</p:column>
						<p:column colspan="5" >
							<p:repeat var="_image" value="#{_cert.certPhotos}" varStatus="_status">
								<div id="imgsPreview" >
									<img  data-original="#{attachmentUtils.getFullPath(_image)}" src="#{attachmentUtils.getFullPath(_image)}"  width="240"/>
								</div>
							</p:repeat>		
						</p:column>
						
					</p:row>
				</p:panelGrid>
			
			</p:repeat>
		</p:panel>
		<p:panel toggleable="true" header="采购方评价">
			<div class="certs">
				<p:dataTable value="#{ratedTradeList.resultList}" var="_trade" rowIndexVar="_row">					
					<p:column>
						<f:facet name="header">项目名称</f:facet>
						#{_trade.bulletin.projectName}
					</p:column>
					<p:column>
						<f:facet name="header">采购方名称</f:facet>
						#{_trade.bulletin.buyer.cnname}
					</p:column>
					<p:column>
						<f:facet name="header">采购方评价</f:facet>
						<ui:include src="/WEB-INF/templates/tradeRatingDetail.xhtml" >
							<ui:param name="tradeRating" value="#{_trade.tradeRating}" />
						</ui:include>						
					</p:column>
				</p:dataTable>
			</div>
		</p:panel>
		<script>
			$(function(){
				$(".myRating").each(function(){
					var _this = $(this);
					_this.css("display","none");
					$($(_this[0]).parents("div.rating-container")).attr("title",_this.val());
				});
			})
	
		</script>
		<c:forEach var="_cert" items="#{serviceSupplierHome.instance.certs}" varStatus="_status">
			<p:dialog id="certImageDialog_#{_status.index}" widgetVar="certImageDialog_#{_status.index}">
				<p:panel>
					<div id="imgsPreview#{_status.index + 10}" >
    					<p:repeat var="_image" value="#{_cert.certPhotos}">
    						<div id="imgsPreview" >
								<img  data-original="#{attachmentUtils.getFullPath(_image)}" src="#{attachmentUtils.getFullPath(_image)}"  width="240"/>
    						</div>
    					</p:repeat>  
    				</div>									
				</p:panel>
			</p:dialog>
		</c:forEach>
	</ui:define>

</ui:composition>